package com.shujia.six;

import org.junit.Test;

import java.io.*;

public class DataSteamDemo {
    @Test
    public void test2() throws IOException {
        DataOutputStream dos = new DataOutputStream(new FileOutputStream("file\\e.txt"));

        dos.writeUTF("你好");
        dos.writeInt(2);
        dos.writeBoolean(true);
        dos.flush();
        dos.close();
    }


    @Test
    public void test1() throws IOException {
        DataInputStream ds = new DataInputStream(new FileInputStream("file\\e.txt"));

        System.out.println(ds.readUTF());
        System.out.println(ds.readInt());
        System.out.println(ds.readBoolean());

        ds.close();

    }
}
